package model01;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class WriteByteToFile {
	public static void main(String[] args) {
		FileOutputStream fos;
		try {
			fos = new FileOutputStream("filebyte.txt");
			
			//xuat ra bang chu cai. Xem bang ma ASCII
			for(int i = 65; i < 91; i++) {
				try {
					fos.write((char)i);
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			
			//dong stream. Neu khong bat "try ... catch" thi phai throws Exception o sau ten ham 
			try {
				fos.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
